<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解封日志</title>
    <script src="/jquery/jquery-3.2.1.min.js"></script>
    <script src="/layui/layui.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css"/>
    <link rel="stylesheet" href="/css/course/course-list.css"/>

</head>
<style>
    .l{
        float: left;
    }
    .r{
        float: right;
    }
</style>
<body style="background-color: #F9F9F9">
<!--title-->
<div style="margin-left: 20px;width: 93%;height: 50px;padding-top: 10px;background-color: #F1F1F1">
    <div>
        <div style="height: 30px; width: 5px;background-color:#009688 " class="l"></div>
        <h3 class="l" style="margin-top: 5px;margin-left: 5px">解封日志</h3>
        <div class="r" style="margin-right: 20px">
            <button type="button" class="layui-btn" onclick="refresh()">刷新</button>
            <button type="button" class="layui-btn" onclick="backOff()">返回</button>
        </div>
    </div>
</div>
<!--检索-->
<div style="margin-left: 20px;width: 93%; height: 50px;margin-top: 20px;border: #F1F1F1 1px solid">
    <div style="padding-top: 5px;margin-bottom: 10px">
        <div class="l" style="margin-top: 10px;margin-left: 10px">
            <i class="layui-icon">&#xe615;</i>
            筛选查询
        </div>
    </div>
</div>
<div style="margin-left: 20px;width: 93%; height: 50px;padding-top: 10px;border: #F1F1F1 1px solid">
    <form class="layui-form">

        <div class="layui-form-item l">

            <label class="layui-form-label">账户名称：</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="account" placeholder="输入姓名">
            </div>

            <label class="layui-form-label">所属部门：</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="deptName" placeholder="输入部门">
            </div>

            <label class="layui-form-label">解封时间：</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="endDate" placeholder="输入注册时间">
            </div>

        </div>

        <div class="r" style="margin-right: 20px">
            <button type="button" class="layui-btn" onclick="retrieval()">搜索</button>
            <button type="button" class="layui-btn" onclick="rest()">重置</button>
        </div>

    </form>
</div>


<!--主体-->
<div style="margin-left: 20px;width: 93%;">
    <table id="myTable" lay-filter="table"></table>
</div>


<input id="userId" type="hidden">
</body>
<script>

    layui.use(['jquery','form','table','layer'],function(){

        var $ = layui.$,
            form = layui.form,
            layer = layui.layer,
            table = layui.table;

    //返回
    backOff = function backOff() {
        var arr = localStorage.getItem("numArr");
        var numArr = arr.split(",");
        numArr.pop();
        window.parent.layui.element.tabChange('tab',numArr[numArr.length - 1]);
        localStorage.setItem("numArr",numArr);
    }
    //刷新
    refresh = function refresh(){
        window.location.reload();
    }


        /*获取数据*/
        tableAjax();
        function tableAjax(){
            $.ajax({
                 url: '/jurisdiction/getUnsealList'
                ,data:{}
                ,dataType: 'json'
                ,success:function(data){
                    renderTable(data.data);
                }

            })
        }

        /*渲染表格*/
        function renderTable(data){
            table.render({
                 elem: '#myTable'
                ,data: data
                ,page: true
                ,cols: [[
                    {checkbox: true}
                    ,{type: 'numbers',title: '序号',align: 'center'}
                    ,{field: 'account',title: '账户名称',align: 'center'}
                    ,{field: 'deptName',title: '部门名称',align: 'center'}
                    ,{field: 'type',title: '用户类型',align: 'center'}
                    ,{field: 'endDate',title: '解封时间',align: 'center'}
                    ,{title: '操作',align: 'center',templet:function(data){
                        return '<a style="color: #0DAB9E;" onclick="see('+data.userCode+')">查看</a>';
                        }}
                ]]
            });
        }

        //查看
        see = function see(id){
            $('#userId').val(id);
            layer.open({
                type: 2
                ,title: '查看用户详情信息'
                ,content: 'popup/backstageStaff-list-see.html'
                ,area: ['1260px','550px']
            });
        }

        //检索
        retrieval = function retrieval(){
            var account = $('input[name=account]').val();
            var deptName = $('input[name=deptName]').val();
            var endDate = $('input[name=endDate]').val();
            $.ajax({
                 url: '/jurisdiction/unsealRetrieval'
                ,data: {
                      'account': account
                     ,'deptName': deptName
                     ,'endDate': endDate
                }
                ,dataType: 'json'
                ,success:function(data){
                    renderTable(data.data);
                }
            });
        }

        //重置检索
        rest = function rest(){
            $('input[name=account]').val('');
            $('input[name=deptName]').val('');
            $('input[name=endDate]').val('');
        }



    });

</script>
</html>